
#include "lua_user_model.h"
#include "string.h"
#include "stdlib.h"




extern int luaopen_student_libs (lua_State *L) ;
extern int luaopen_user_timer_libs (lua_State *L) ;
extern int luaopen_memlibs(lua_State *L) ;
extern int luaopen_syslibs(lua_State *L) ;
extern int luaopen_user_byte_libs(lua_State *L) ;

extern int luaopen_user_socket_libs(lua_State *L) ;
extern int luaopen_user_mqtt_libs (lua_State *L) ;
extern int luaopen_user_pin_libs (lua_State *L);




static const luaL_Reg loaduserlibs[] = {
    {"student",luaopen_student_libs},
    {"timer",luaopen_user_timer_libs},
    {"mem",luaopen_memlibs},
    {"sys",luaopen_syslibs},
    {"byte",luaopen_user_byte_libs},
    {"socket",luaopen_user_socket_libs},
    {"mqtt",luaopen_user_mqtt_libs},
    {"pin",luaopen_user_pin_libs},
    {NULL, NULL}
};


LUALIB_API void lua_openuserlibs(lua_State *L){
const luaL_Reg *lib;
  /* "require" functions from 'loadedlibs' and set results to global table */
  for (lib = loaduserlibs; lib->func; lib++) {
    luaL_requiref(L, lib->name, lib->func, 1);
    lua_pop(L, 1);  /* remove lib */
  }

}